<?php
class admin_home extends CI_Controller {
	
	protected $data;

	function  __construct()  {
		$this->_initdata();
	}
	//default page (tim_kiem)
	function index() {
		$this->data['link_page_name']="admin_home";
		$this->data['page_title']="Hình ảnh";
		$this->data['admintitle_news'] = ADMINTITLE_NEWS;
                $this->data['admintitle_news_auto'] = ADMINTITLE_NEWS_AUTO;
                $this->data['admintitle_video'] = ADMINTITLE_VIDEO;
                $this->data['admintitle_customs'] = ADMINTITLE_CUSTOMS;
		$this->data['admintitle_adv'] = ADMINTITLE_ADV;
		$this->data['admintitle_faq'] = ADMINTITLE_FAQ;
		$this->data['admintitle_contact'] = ADMINTITLE_CONTACT;
		$this->data['admintitle_common'] = ADMINTITLE_COMMON;
		$this->data['admintitle_stats'] = ADMINTITLE_STATS;
		$this->data['admintitle_beuser'] = ADMINTITLE_BEUSER;		
		$this->data['base_page'] = DEFAULT_PAGE;	
		$this->data['page_id'] = "ul_postcontainer";	
		$this->data['page_name'] = "admin_home";	
		$this->data['website_name'] = WEBSITE_NAME;	
		$this->data['adminusername'] = $this->Adminmodel->_get_session(SESSION_ADMINUSERNAME);
		$this->data['base_url']=$this->config->item('base_url');
		//var_dump($this->data);
		$this->showadmin($this->data);
	}		
	
	function _initdata()
	{
		parent::__construct();
		session_start();
		$this->load->model('Adminmodel');
		$this->load->helper('url');
		$this->_check_admin_login();
	}	
	
	function _check_admin_login()
	{
		if ($this->Adminmodel->_check_login(SESSION_ADMINUSERNAME) == false)
		{
			$base_url=$this->config->item('base_url');
			redirect($base_url.'admin_login', 'location', 301);
		}		
	}
	
}
?>